package cn.wuqingna.legendgem.script

import cn.wuqingna.legendgem.api.LegendGemAPI
import cn.wuqingna.legendgem.util.ReportUtil
import org.bukkit.entity.Player


object EvalScript: Script {
    override val key: String
        get() = "eval"

    override fun eval(player: Player, args: String, cache: MutableMap<String, String>): String {
        return try {
            LegendGemAPI.decimalFormat.format(ReportUtil.getResult(args))
        } catch (e: Exception) {
            error("eval 语句错误 $args")
        }
    }
}